package com.example.playandroid.ui

import android.view.KeyEvent
import android.view.View
import com.example.myapplication.databinding.ActivityWelcomePaBinding
import com.example.playandroid.core.view.base.BaseActivity

class WelcomeActivity : BaseActivity(), View.OnClickListener {
    private var exitTime: Long = 0
    private lateinit var binding: ActivityWelcomePaBinding
    private var animationTime: Long = 500

    override fun onClick(v: View?) {
        TODO("Not yet implemented")
    }

    override fun initData() {
        TODO("Not yet implemented")
    }

    override fun initView() {
        TODO("Not yet implemented")
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            exit()
            return false
        }
        return super.onKeyDown(keyCode, event)
    }

    override fun getLayoutView(): View {
        binding = ActivityWelcomePaBinding.inflate(layoutInflater)
        return binding.root
    }


    private fun exit() {
        if (System.currentTimeMillis() - exitTime > 2000) {
            exitTime = System.currentTimeMillis()
        } else {
            finish()
        }
    }
}